﻿/*
 * Title :窗口类
 * Author:吉阳
 * Date  :2020.4.20
 * 
 * **********************************
 * 游戏主菜单窗口
 * 使用方法
 * 直接调用各个主要方法
 * 进行功能切换
 * ********************************** 
 * 
 * 让我测试一下github
 */


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Text;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Project_Origin
{
    public partial class PO_MainMenu : Form
    {
        PrivateFontCollection pfc = new PrivateFontCollection();

        public PO_MainMenu()
        {
            InitializeComponent();
        }

        //定义的鼠标坐标类
        private Point mousePoint = new Point();

        //说明按键的功能实现
        private void PO_Information_Button_Click(object sender, EventArgs e)
        {
            PO_Teach_Form pO_Teach_Form = new PO_Teach_Form();
            pO_Teach_Form.Show();
            this.Hide();
        }

        //赞助按键的功能实现
        private void PO_Support_Button_Click(object sender, EventArgs e)
        {
            PO_Support_Form pO_Support_Form = new PO_Support_Form();
            pO_Support_Form.Show();
            this.Hide();
        }

        //最小化按键的功能实现
        private void PO_MixNum_Button_Click(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Minimized;
        }

        //关闭按钮功能实现
        private void PO_Button_Exit_Click(object sender, EventArgs e)
        {
            PO_Timer1.Start();
        }

        //退出按键的功能实现
        private void PO_Exit_Button_Click(object sender, EventArgs e)
        {
            PO_Timer1.Start();
        }
        
        //开始按键的功能实现
        private void PO_Start_Button_Click(object sender, EventArgs e)
        {
            
            PO_ModeSelect_Menu pO_ModeSelect_Menu = new PO_ModeSelect_Menu();
            pO_ModeSelect_Menu.Show();
            this.Hide();
            
        }

        //窗口拖动的功能实现
        public void PO_MainMenu_MouseDown(object sender, MouseEventArgs e)
        {
            this.mousePoint.X = e.X;
            this.mousePoint.Y = e.Y;
        }

        public void PO_MainMenu_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                this.Top = Control.MousePosition.Y - mousePoint.Y + 13;
                this.Left = Control.MousePosition.X - mousePoint.X + 13;
            }
        }
        //计时器 用于关闭特效
        private void PO_Timer1_Tick(object sender, EventArgs e)
        {
            if (this.Opacity >= 0.08)
                this.Opacity -= 0.08;
            else
            {
                PO_Timer1.Stop();
                this.Close();
                Environment.Exit(Environment.ExitCode);
            }
        }
        private void pO_LOGO_Tools_RE1_Click(object sender, EventArgs e)
        {
            PO_Member_List pO_Member_List = new PO_Member_List();
            pO_Member_List.Show();
            this.Hide();
        }

        private void PO_MainMenu_Load(object sender, EventArgs e)
        {
            string AppPath = Application.StartupPath;
            PrivateFontCollection privateFonts = new PrivateFontCollection();
            try
            {
                privateFonts.AddFontFile(AppPath + @"\Resources\站酷快乐体.ttf");//加载字体
                Font font = new Font(privateFonts.Families[0], 12);
                label1.Font = font;            }
            catch
            {
                MessageBox.Show("字体不存在或加载失败\n程序将以默认字体显示", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
    }
}
